/**
 * @author Alias Cummins
 */
class com.proalias.animation.tween.FunctionCall {
	
	private var $funcName:String;
	private var $scope:Object;
	private var $args:Array;
	private var $delay:Number;
	private var $time:Number;
	
	public function FunctionCall(scope:Object,funcName:String,args:Array,delay:Number) {
		$funcName = funcName;
		$scope = scope;
		$args = args;
		$time = 0;
		if ($delay == undefined){
			$delay = 0;
		}else{
			$delay = delay;
		}
	
	}
	
	public function execute():Boolean{
		trace("FunctionCall.execute()");

		if ($time < $delay){
			$time++;
			return true;
		}else{
			$scope[$funcName].apply($scope,$args);
			return false;
		}
	}
}